package com.ruixinzheng.logicdemo.notification;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Build;

import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.navigation.NavDeepLinkBuilder;

import com.ruixinzheng.logicdemo.R;

public class NotificationDemo {
    private static int mNotifyId = 0;
    public static void sendNotification(Context context) {
        String channelId = context.getPackageName();
        if (Build.VERSION.SDK_INT >= 26) {
            NotificationChannel channel = new NotificationChannel(channelId, channelId, NotificationManager.IMPORTANCE_DEFAULT);
            channel.setDescription("description");
            NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
            notificationManager.createNotificationChannel(channel);
        }

//        PendingIntent pendingIntent = new NavDeepLinkBuilder(context)
//                .setGraph(R.navigation.mobile_navigation)
//                .setDestination(R.id.fragment_d)
//                .createPendingIntent();
//
//        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId)
//                .setSmallIcon(R.drawable.ic_launcher_background)
//                .setContentTitle("Title")
//                .setContentText("Message")
//                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
//                .setContentIntent(pendingIntent)
//                .setAutoCancel(false);
//
//        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
//        notificationManager.notify(++mNotifyId, builder.build());
    }
}
